<template>
  <template v-for="(item) in dict">
    <el-tag :type="item.listClass" v-show="item.dictValue === props.value">{{ item.dictLabel }}</el-tag>
  </template>
</template>

<script setup lang="ts">
import {Dict} from "~/entity/dict";

const props = defineProps({
  dictType: {
    type: String,
    required: true
  },
  value: {
    type: String,
    required: true
  }
});
onBeforeMount(() => {
  getDict();
});
const dictType = toRef(props, "dictType");
const dict = ref<Dict[]>([]);
const getDict = () => {
  useUtils().DictUtils.getDictList(dictType.value).then((res: any) => {
    dict.value = res;
  });
};
</script>

<style scoped lang="scss">
</style>